package com.bookkeeping.bookkeepingapi.repository;

import com.bookkeeping.bookkeepingapi.model.BookKeep;
import com.bookkeeping.bookkeepingapi.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;

@Repository
public interface BookKeepRepository extends JpaRepository<BookKeep,Integer>, JpaSpecificationExecutor<BookKeep> {

    long deleteByUser(User user);

    List<BookKeep> findByUserId(Integer userId);

    List<BookKeep> findByYearAndMonthAndUserId(Integer year,Integer month,Integer userId);


    List<BookKeep> findByUserIdAndBookKeepDateBetween(Integer userId, LocalDate startDate, LocalDate endDate);
}
